﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData.Query;

namespace Devonline.Identity.Admin.Controllers;

[Route("api/[controller]")]
[ApiController]
[SecurityHeaders]
[Authorize(Roles = GROUP_MAINTAINERS)]
public class LevelsController : ODataServiceController<Level>
{
    private readonly IExcelExportService _excelExportService;
    public LevelsController(ILogger<LevelsController> logger, IDataWithAttachmentService<Level> dataService, IExcelExportService excelExportService) : base(logger, dataService) => _excelExportService = excelExportService;

    [HttpGet("Export")]
    public async Task<IActionResult> ExportAsync(ODataQueryOptions<Level> options) => await _excelExportService.ExportAsync(await base.ExportAsync(options));
}